//
//  ChoicenessTableViewCell.m
//  项目
//
//  Created by 杨世博 on 15-1-4.
//  Copyright (c) 2015年 张诗雨. All rights reserved.
//

#import "ChoicenessTableViewCell.h"
#import "WebColor.h"
@implementation ChoicenessTableViewCell
- (void)dealloc
{
    [_backgroundImage release];
    [_coveringImage release];
    [_listenImage release];
    [_listenNumLabel release];
    [_titleLable release];
    [_uNameLable release];
    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setBackgroundColor:[WebColor whiteSmoke]];
        self.backgroundImage = [[UIImageView alloc] init];
        [self.backgroundImage setImage:[UIImage imageNamed:@"bg_share_large.png"]];
        [self.contentView addSubview:_backgroundImage];
        [_backgroundImage release];
        
        self.coveringImage = [[UIImageView alloc] init];
        [_coveringImage setBackgroundColor:[WebColor tan]];
        [self.backgroundImage addSubview:_coveringImage];
        [_coveringImage release];
        
        self.listenImage = [[UIImageView alloc] init];
        [_listenImage setImage:[UIImage imageNamed:@"listenNum.png"]];
        [self.backgroundImage addSubview:_listenImage];
        [_listenImage release];
        
        self.listenNumLabel = [[UILabel alloc] init];
        [_listenNumLabel setFont:[UIFont systemFontOfSize:15.0f]];
        [_listenNumLabel setTextColor:[WebColor snow]];
        [self.coveringImage addSubview:_listenNumLabel];
        [_listenNumLabel release];
        
        self.titleLable = [[UILabel alloc] init];
        [_titleLable setFont:[UIFont systemFontOfSize:17.0f]];
        [self.backgroundImage addSubview:_titleLable];
        [_titleLable release];
        
        self.uNameLable = [[UILabel alloc] init];
        [_uNameLable setFont:[UIFont systemFontOfSize:15.0f]];
        [_uNameLable setTextAlignment:NSTextAlignmentRight];
        [_uNameLable setTextColor:[WebColor silver]];
        [self.backgroundImage addSubview:_uNameLable];
        [_uNameLable release];
        
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    [self.backgroundImage setFrame:CGRectMake(10, 10, self.frame.size.width - 20, self.frame.size.height - 20)];
    [self.coveringImage setFrame:CGRectMake(0, 0, self.backgroundImage.frame.size.width, (self.frame.size.height - 20) * 4 / 5)];
    [self.listenImage setFrame:CGRectMake(0, (self.frame.size.height - 20) * 3 / 5, 15, 15)];
    [self.listenNumLabel setFrame:CGRectMake(15, (self.frame.size.height - 20) * 3 / 5, self.frame.size.width / 4, 15)];
    [self.titleLable setFrame:CGRectMake(10, (self.frame.size.height - 20) * 4 / 5, self.frame.size.width * 3 / 5, (self.frame.size.height - 20)/ 5)];
    [self.uNameLable setFrame:CGRectMake(10 + self.frame.size.width * 3 / 5, (self.frame.size.height - 20) * 4 / 5, self.frame.size.width * 2 / 5 - 20, (self.frame.size.height - 20) / 5)];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
